var XMLHttpRequest = function XMLHttpRequest() {
    //如果不能new  要抛出一个错误
}//构造函数
catvm.safefunction(XMLHttpRequest); //tostring 保护
//设置原型链上显示的名字***************************************************************************
Object.defineProperties(XMLHttpRequest.prototype, {
    [Symbol.toStringTag]: {
        value: "XMLHttpRequest",
        configurable: true
    }
});
// 原型指向原型父亲***************************************************************************
XMLHttpRequest.prototype.__proto__ = XMLHttpRequestEventTarget.prototype

// 属性及方法*****************************************************************
XMLHttpRequest.prototype.is_open_send = [false, false] // 框架自用，用来判断是否执行过open，send
XMLHttpRequest.prototype.headers = {}
XMLHttpRequest.prototype.catvm_send = {}

XMLHttpRequest.prototype.readyState = 0
XMLHttpRequest.prototype.status = 0
XMLHttpRequest.prototype.responseText = ''
XMLHttpRequest.prototype.timeout = 0
XMLHttpRequest.prototype.setRequestHeader = function setRequestHeader(k, v) {
    // 该方法必须在 open之后  send之前使用
    catvm.debugger_()
    if (this.is_open_send[0] || !this.is_open_send[1]) {
        this.headers[k] = v
    }
};
catvm.safefunction(XMLHttpRequest.prototype.setRequestHeader)
XMLHttpRequest.prototype.open = function open(method, url, async, user, pwd) {
    catvm.debugger_()
    this.catvm_send["method"] = method
    this.catvm_send["url"] = url
    this.catvm_send["async"] = async
    this.catvm_send["pwd"] = pwd
    this.catvm_send["user"] = user
    this.is_open_send[0] = true
};
catvm.safefunction(XMLHttpRequest.prototype.open)

XMLHttpRequest.prototype.send = function send(body) {
    catvm.debugger_()
    this.is_open_send[1] = true
    debugger
    catvm.data.header = this.headers
    catvm.data.body = body
    catvm.data.url = this.catvm_send
    catvm.data.cookie = document.cookie
    if (catvm.data.next_status === 1) {
        this.readyState = 4
        this.status = 200
        this.responseText = catvm.data.xmldata
        this.onreadystatechange()
    }

    // Send_s(
    //     this.catvm_send["url"],
    //     this.catvm_send["method"],
    //     body,
    //     this.headers,
    //     this.timeout
    // )
};
catvm.safefunction(XMLHttpRequest.prototype.send)


XMLHttpRequest = catvm.proxy(XMLHttpRequest)